<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
require_once 'Zend/Db/Table/Abstract.php';
class Admin_Models_MenuModel extends Zend_Db_Table_Abstract
{
    /**
     * The default table name 
     */
    protected $_name = 'menu';
    protected $_primary = 'id';
    function loadmainmenu(){
       $db = Zend_Db_Table::getDefaultAdapter();
       $sql = $db->select()->from('menu')->where("parent = 0");
       $result = $db->fetchAll($sql);
       return $result;        
    }
    function loadsubmenu($id){
       $db = Zend_Db_Table::getDefaultAdapter();
       $sql = $db->select()->from('menu')->where("parent = ".$id)->order('ordering');
       $result = $db->fetchAll($sql);
       return $result;        
    }
}
?>
